using UnityEngine;
using System.Collections;

public class SpellIcon : MonoBehaviour {

	Spells spell = new Spells();
	private OnMouseOverSpellIconDelegate onMouseOverMethod;
	private OnMouseClicSpellIconDelegate onMouseClicMethod;
	
	public Spells Spell
	{
		get { return spell; }
	}
	
	public void InitSpellIcon(Spells s, OnMouseOverSpellIconDelegate fctOver, OnMouseClicSpellIconDelegate fctClic)
	{
		spell = s;
		this.renderer.material.mainTexture = spell.Image;
		onMouseOverMethod = fctOver;
		onMouseClicMethod = fctClic;
	}
	
	void OnMouseUpAsButton ()
	{
		onMouseClicMethod(this);
	}
	
	void OnMouseEnter ()
	{
		onMouseOverMethod(this, true);
	}
	
	void OnMouseExit ()
	{
		onMouseOverMethod(this, false);
	}
}
